package com.struct.graph.room_list
{
	import com.collection.ACollection;
	import com.component.ComponentChildren;
	import com.component.button.Button;
	import com.events.RoomListSelectEvent;
	import com.events.ServerListSelectEvent;
	import com.utils.Utils;
	
	import flash.events.EventDispatcher;
	import flash.events.MouseEvent;
	
	public class RoomListShow extends ComponentChildren
	{
		private var btnSubmit:Button;
		private var dispatcher:EventDispatcher;
		
		public var id:uint;
		public function RoomListShow(id:uint, dispatcher:EventDispatcher)
		{
			super();
			this.id = id;
			this.name = name;
			this.dispatcher = dispatcher;
			width = 190;
			height = 120;
			graphics.beginFill(0x00);
			graphics.drawRect(0, 0, width, height);
			graphics.drawRect(2, 2, width - 4, height - 4);
			graphics.endFill();
			
			Utils.createTextField(this, 5, 5, "id:" + id, 12, 0, true);
			Utils.createTextField(this, 38, 5, "人满就开喽~~~", 12, 0, true);
			Utils.createTextField(this, 60, 25, "很有爱的大地图", 12, 0, true);
			Utils.createTextField(this, 120, 55, "30秒", 12, 0, true);
			Utils.createTextField(this, 60, 100, "3/4", 12, 0, true);
			
			btnSubmit = new Button("进入", 80);
			btnSubmit.x = 110;
			btnSubmit.y = 90;
			addChild(btnSubmit);
			btnSubmit.addEventListener(MouseEvent.CLICK, clickHandler);
		}
		private function clickHandler(e:MouseEvent):void{
			dispatcher.dispatchEvent(new RoomListSelectEvent(ACollection.SELECTED, this));
		}
	}
}